#!/bin/bash

set -x

#chown -R www-data:www-data /var/www
#find /var/www -type f -exec chmod 644 {} \;
#find /var/www -type d -exec chmod 755 {} \;
#
#if [[ -f /var/www/bin/phantomjs ]];then
#    chmod 777 /var/www/bin/phantomjs
#fi

rm -rf /etc/default/locale
env >> /etc/default/locale

# Set # of hard links to 1 to keep cron happy.
#touch /etc/cron.d/php /var/spool/cron/crontabs/www-data /etc/crontab

echo '* * * * * www-data /usr/local/bin/php /var/www/artisan schedule:run >> /var/log/cron.log 2>&1' >> /etc/crontab
echo '#' >> /etc/crontab

exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
